package E2020;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class UDPServer {
    public static void main(String[] args) {
        DatagramSocket client = null;
        DatagramPacket sendPacket = null;
        try{
            client = new DatagramSocket(7777);

            String str = "你好,请问可以访问吗？";
            sendPacket = new DatagramPacket(str.getBytes(),0,str.length(), InetAddress.getLocalHost(),8888);

            System.out.println("客户端发送信息中....");
            client.send(sendPacket);
        } catch (Exception e){
            e.printStackTrace();
        }
    }
}
